package com.originskyseed.platform.role.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.originskyseed.platform.role.model.Role;

/**
 * 角色表Mapper类（OSI_ROLE）
 * 
 * @author LiangMingHui
 */
public interface RoleMapper {

	/**
	 * 删除记录
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 * 
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(Role record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(Role record) throws Exception;

	/**
	 * 更新记录
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(Role record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(Role record) throws Exception;

	/**
	 * 修改置顶的为不置顶
	 *
	 * @return
	 * @throws Exception
	 */
	public int updateIsTop() throws Exception;

	/**
	 * 查询记录
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Role selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询列表
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<Role> selectList(Role record) throws Exception;

	/**
	 * 分页查询列表
	 * 
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Role> selectListByPage(Map<String, Object> params) throws Exception;

	/**
	 * 分页查询列表,关联商城表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Role> selectListJoinMallByPage(Map<String, Object> params) throws Exception;

	/**
	 * 分页查询列表,关联商城表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Role> selectListJoinMall(Map<String, Object> params) throws Exception;

	/**
	 * 是否存在角色代码
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public Boolean existCode(Role record) throws Exception;

	/**
	 * 根据用户标识获取角色列表
	 * 
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public List<Role> selectByUserId(String userId) throws Exception;

	/**
	 * 根据code码查询角色
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public Role selectByCode(Map<String, Object> params) throws Exception;

	/**
	 * 根据userAccount查询供应商状态
	 * 
	 * @param userAccount
	 * @return
	 * @throws Exception
	 */
	public Integer selectSupplierNameByUserAccount(@Param("userAccount") String userAccount) throws Exception;

	/**
	 * 根据userId 和mallId 查询关联记录
	 * 
	 * @param userId
	 * @param mallId
	 * @return
	 */
	public List<Role> selectByUserIdAndMallId(@Param("userId") String userId, @Param("mallId") String mallId) throws Exception;

	/**
	 * 批量修改状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int updateStatusByIds(Map<String, Object> map) throws Exception;


	/**
	 * 批量修改状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int updateIsDelByIds(Map<String, Object> map) throws Exception;

	/**
	 * 查询角色编号
	 * 
	 * @return
	 * @throws Exception
	 */
	public String selectRoleCode() throws Exception;

	/**
	 * 查询最大的优先级
	 * 
	 * @return
	 * @throws Exception
	 */
	public Integer selectPrority() throws Exception;

	/**
	 * 根据优先级查询角色
	 * 
	 * @param prority
	 * @return
	 * @throws Exception
	 */
	public Role selectRoleByPrority(Integer prority) throws Exception;

	/**
	 * 根据优先级查询角色
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Role selectByPrioritySort(Map<String, Object> map) throws Exception;

	/**
	 * 根据角色code查询角色
	 * @param code
	 * @return
	 * @throws Exception
	 */
	public Role selectByRoleCode(@Param("code") String code) throws Exception;
}